package com.webchat.admin.service.mall;

import com.webchat.common.bean.APIPageResponseBean;
import com.webchat.common.bean.APIResponseBean;
import com.webchat.common.bean.APIResponseBeanUtil;
import com.webchat.common.exception.BusinessException;
import com.webchat.domain.vo.request.mall.ShopReviewRequestVO;
import com.webchat.domain.vo.response.mall.MallShopReviewResponseVO;
import com.webchat.rmi.pgc.mall.MallShopClient;
import com.webchat.rmi.pgc.mall.MallShopReviewClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MallShopReviewService {

    @Autowired
    private MallShopReviewClient mallShopReviewClient;


    public APIPageResponseBean<MallShopReviewResponseVO> page(
                String shopName, Integer reviewStatus, Integer pageNo, Integer pageSize) {

        return mallShopReviewClient.page(shopName, reviewStatus, pageNo, pageSize);
    }


    /**
     * 店铺审核
     *
     * @param shopReviewRequest
     * @return
     */
    public Boolean review(ShopReviewRequestVO shopReviewRequest) {
        APIResponseBean<Boolean> responseBean = mallShopReviewClient.review(shopReviewRequest);
        if (APIResponseBeanUtil.isOk(responseBean)) {
            return responseBean.getData();
        }
        throw new BusinessException("审核失败：" + responseBean.getMsg());
    }
}
